import { Component } from "react";
import { Button } from "antd";
import "antd/es/button/style/css";

export default class Home extends Component {
  handClick = () => {
    const { history } = this.props;
    const auth = sessionStorage.getItem("USER");
    if (typeof history.push === "function") {
      if (auth) {
        history.push({
          pathname: "/backend",
        });
      } else {
        history.push({
          pathname: "/login",
        });
      }
    }
  };
  render() {
    return (
      <div className="home">
        <div className="home-img-wrap"></div>
        <Button
          onClick={this.handClick}
          className="enter-btn"
          type="primary"
          size="large"
        >
          点击登录
        </Button>
      </div>
    );
  }
}
